/**
 * Created by chenliang on 2017/3/17.
 */

function dataRequest()
{
    var data = {};
    data.password =  "a111111";
    data.responseDataType =  "JSON";
    data.username =  "zzzzz";
    return data;
}

/* 登陆 */
function login() {
    // var dataRequest = {};
    // dataRequest.requestMetaInfo = requestData();
    var url = 'http://192.168.161.137:8480/login';
    $.ajax({
        url:url,
        dataType:'json',
        data: JSON.stringify(dataRequest()),
        type:'post',
        contentType : "application/json;utf-8",
        success:function(data){
            // alert(data.userName);
            if (data.username.length > 0)
            {
                logginRespon.username = data.username;
                logginRespon.apiSignCode = data.apiSignCode;
                logginRespon.apiUserName = data.apiUserName;
                logginRespon.contactMobile = data.contactMobile;
                logginRespon.contactUserName = data.contactUserName;
                logginRespon.userKey = data.userKey;
            }
            else
            {
                alert("登陆失败");
            }
        },
        error:function(data) {
            alert(data.name);
        }});
}

/* 获取用户信息 */
function mineInfo() {
    var userObj = {};
    userObj.loginUserName = "zzzzz";

    var dataRequest = {};
    dataRequest.requestMetaInfo = requestData();
    dataRequest.AppUserInfoRequest = userObj;

    var url = 'http://192.168.161.137:8480/service/flight/domestic';
    $.ajax({
        url:url,
        dataType:'json',
        data: JSON.stringify(dataRequest),
        type:'post',
        contentType : "application/json;utf-8",
        success:function(data){
            alert(data.userName);
        },
        error:function(data) {
            alert(data.name);
        }});
}

/* 旅游查询列表 */
function  queryTravelList() {
    var keyWork = {};
    keyWork.customerKey = apiuserName();
    keyWork.page = "1";
    keyWork.pageSize = "20";
    keyWork.searchWord = "迪拜";

    var dataRequest = {};
    dataRequest.requestMetaInfo = requestData();
    dataRequest.SearchRouteBySearchwordRequest = keyWork;

    var url = 'http://192.168.161.137:8480/service/flight/travel';
    $.ajax({
        url:url,
        dataType:'json',
        data: JSON.stringify(dataRequest),
        type:'post',
        contentType : "application/json;utf-8",
        success:function(data){
            alert(data.userName);
        },
        error:function(data) {
            alert(data.name);
        }});
}

/* 旅游产品详情 */

function  queryTravelDetail() {
    var routeDetail = {};
    routeDetail.customerKey = apiuserName();
    routeDetail.routeId = "1701171434119601";

    var dataRequest = {};
    dataRequest.requestMetaInfo = requestData();
    dataRequest.GetRouteDetailRequest = routeDetail;

    var url = 'http://192.168.161.137:8480/service/flight/travel';
    $.ajax({
        url:url,
        dataType:'json',
        data: JSON.stringify(dataRequest),
        type:'post',
        contentType : "application/json;utf-8",
        success:function(data){
            alert(data.userName);
        },
        error:function(data) {
            alert(data.name);
        }});
}

/* 常旅客列表 */
function  travellerQueryRequest() {
    var routeDetail = {};
    routeDetail.default = "default";

    var dataRequest = {};
    dataRequest.requestMetaInfo = requestData();
    dataRequest.TravellerQueryRequest = routeDetail;

    var url = 'http://192.168.161.137:8480/service/flight/basic';
    $.ajax({
        url:url,
        dataType:'json',
        data: JSON.stringify(dataRequest),
        type:'post',
        contentType : "application/json;utf-8",
        success:function(data){
            alert(data.userName);
        },
        error:function(data) {
            alert(data.name);
        }});
}

/* 旅游订单详情 */
function travellerOrderDetail() {

    var routeDetail = {};
    routeDetail.customerkey = apiuserName();
    routeDetail.orderId = "1703030952108610";

    var dataRequest = {};
    dataRequest.requestMetaInfo = requestData();
    dataRequest.GetOrderDetailRequest = routeDetail;

    var url = 'http://192.168.161.137:8480/service/flight/travel';
    $.ajax({
        url:url,
        dataType:'json',
        data: JSON.stringify(dataRequest),
        type:'post',
        contentType : "application/json;utf-8",
        success:function(data){
            alert(data.userName);
        },
        error:function(data) {
            alert(data.name);
        }});
}

/* 旅游首页 */
function travellerOrderDetail() {

    var routeDetail = {};
    routeDetail.customerkey = apiuserName();
    routeDetail.title = "appJourney";

    var dataRequest = {};
    dataRequest.requestMetaInfo = requestData();
    dataRequest.GetRecommendColumnsRequest = routeDetail;

    var url = 'http://192.168.161.137:8480/service/flight/travel';
    $.ajax({
        url:url,
        dataType:'json',
        data: JSON.stringify(dataRequest),
        type:'post',
        contentType : "application/json;utf-8",
        success:function(data){
            alert(data.userName);
        },
        error:function(data) {
            alert(data.name);
        }});
}


/* 旅游首页 */
function travellerOrderDetail() {

    var routeDetail = {};
    routeDetail.customerkey = apiuserName();
    routeDetail.title = "appJourney";

    var dataRequest = {};
    dataRequest.requestMetaInfo = requestData();
    dataRequest.GetRecommendColumnsRequest = routeDetail;

    var url = 'http://192.168.161.137:8480/service/flight/travel';
    $.ajax({
        url:url,
        dataType:'json',
        data: JSON.stringify(dataRequest),
        type:'post',
        contentType : "application/json;utf-8",
        success:function(data){
            alert(data.userName);
        },
        error:function(data) {
            alert(data.name);
        }});
}

$(document).ready(function(){
    $("#hide").click(function () {
        login();
    });

    $("#show").click(function () {
        travellerOrderDetail();
    });
});


